﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Common.Logging;

namespace OF.Utility.Logging
{
    /// <summary>
    /// 异常日志记录器
    /// </summary>
    public abstract class ErrorLogHelper
    {
        private const string LoggerName = "ErrorLogAdoNetAppenderLogger";
        public static void Error(ErrorLog errorInfo)
        {
            ILog logger = LogManager.GetLogger(LoggerName);
            //记录错误日志
            //if (logger.IsErrorEnabled)
            //{
            //    logger.Error(errorInfo);
            //}
            logger.Error(errorInfo);
        }
        public static void Error(Exception ex)
        {
            ErrorLog oLog=new ErrorLog();
            oLog.ErrorMessage = ex.Message;
            oLog.ErrorSource = ex.Source;
            oLog.ErrorTrace = ex.StackTrace;
            Error(oLog);
        }
    }
}
